﻿using Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DAL
{
    public class financeDAL : PageDAL<MoneyModel>
    {
        public MoneyModel GetModelByID(string tableName, int pid)
        {
            string sql = $"select * from  {tableName} where id='{pid}'";
            DataTable dt = new DBHelper().GetDataTable(sql);
            MoneyModel model = new MoneyModel()
            {
                ID = int.Parse(dt.Rows[0]["ID"].ToString()),
                ShouRu = decimal.Parse(dt.Rows[0]["ShouRu"].ToString()),
                ZhiChu = decimal.Parse(dt.Rows[0]["ZhiChu"].ToString()),
                XinZi = decimal.Parse(dt.Rows[0]["XinZi"].ToString()),
                
            };
            return model;
        }
    }
}
